<?php

namespace App\Http\Controllers\Api\v1;

use App\common;
use App\Http\Controllers\Controller;
use App\Logic\TencentLogic;
use Illuminate\Http\Request;

class Tencent extends Controller
{
    /**
     * @param Request $request
     * @return array|false|string
     * @throws \Exception
     * 小程序客服多功能聊天获取userSig接口
     * @yuankai
     */
    public function sdk(Request $request)
    {
        if ($request->method() == 'GET'){
            try {
                $res = TencentLogic::sdk();
                if ($res){
                    return common::success('200',$res,'userSig获取成功');
                }
            }catch (\Exception $exception){
                return common::fail('','',$exception->getMessage());
            }
        }else{
            return common::fail('','','请求方式不正确');
        }
    }

    /**
     * 账号-小程序客服多功能聊天获取userSig接口
     * @yuankai
     */
    public function admin(Request $request)
    {
        if ($request->method() == 'GET'){
            try {
                $res = TencentLogic::admin();
                if ($res){
                    return common::success('200',$res,'userSig获取成功');
                }
            }catch (\Exception $exception){
                return common::fail('','',$exception->getMessage());
            }
        }else{
            return common::fail('','','请求方式不正确');
        }
    }
}
